
package database;

import database.DatabaseInteraction;
import logindata.User;

public class EditUsers {

    private static User[] users;

    public static User[] getUsers() {
        users = DatabaseInteraction.getAllUsers();
        return users;
    }

    public static void editUser(int index, String username, String password, int permissions) {
        getUsers();
        users[index] = new User(username, password, permissions);
    }

    public static void updateUser(String currentUsername, User user) {
        updateUser(currentUsername, user.getUserName(), user.getPassword(), user.getPermissions());
    }

    public static void updateUser(String currentUsername, String username, String password, int permissions) {
        DatabaseInteraction.postUser(currentUsername, username, password, permissions);
    }
}
